<?php

								if ( isset($_SESSION['auth'] ))
								{
							  ?>
								<p class="icon-ok i92"></p>

								<div class="info-page">
								<script type="text/javascript">
									//<![CDATA[
									$(document).ready(function() {

										var options = { 
											beforeSubmit:  checkInfos,  // pre-submit callback 
											success:       sendRep,  // post-submit callback 
											url:		   'php/mod_profil.php', 
										}; 
										$('#modifinfos').ajaxForm(options);
											function checkInfos(formData, jqForm, options) { 
											var form = jqForm[0]; 
											if (!form.email.value) { 
												$('.icon-ok').html('Vous devez renseigner un email');
												$('.icon-ok').slideToggle('slow'); 
												return false; 
											} 
											return true; 
										}
										function sendRep(formData, jqForm, options) {
											$(".icon-ok").hide();
											$(".icon-ok").html('Votre profil a &eacute;t&eacute; modifi&eacute;').slideToggle('slow');
										}
										});
									//]]>
								</script>
								<?php
								
								$sql = "SELECT * FROM $table_name 
								  WHERE user_name='$_SESSION[logname]'";
								$result = mysql_query($sql,$db);
								$infos = mysql_fetch_array($result);
								
								?>
								<form method="post" id="modifinfos" name="modifinfos">

									<p><label for="prenom">Prenom: </label><input id="first_name" type="text" name="prenom" size="20" value="<?php echo $infos['first_name'];?>" /></p>
									<p><label for="nom">Nom: </label><input id="last_name" type="text" name="nom" value="<?php echo $infos['last_name'];?>" /></p>
									<p><label for="rue">Rue: </label><input id="street" type="text" name="rue" value="<?php echo $infos['street'];?>" /></p>
									<p><label for="ville">Ville: </label><input id="city" type="text" name="ville" value="<?php echo $infos['city'];?>" /></p>
									<p><label for="cp">Code postal: </label><input id="zip" type="text" name="cp" value="<?php echo $infos['zip'];?>" /></p>	
									<p><label for="email">Email: </label><input id="mail" type="text" name="email" value="<?php echo $infos['email'];?>" /></p>
									<p><label for="phone">Tel:<br/> </label><input type="text" name="phone" value="<?php echo $infos['phone'];?>" /></p>
									<input type="text" name="valid" value="ok" class="hidden" />
									<p><input type="submit" name="validProfil" value="Envoyer" /></p>
								</form>
								</div>



							  <?php }
							  else { include 'erreur.php'; } ?>